home *** CD-ROM | disk | FTP | other *** search
Wrap
/* Program to use Image Engineer to display a whole directory of files, including subdirectories. If a file is an anim, the first frame is displayed. Images can be scaled to a uniform size. If it jams up while trying to load in a binary file which it thinks (wrongly) is a Targa or PCX image, just click on Abort. */ /* Written by Don Cox, Oct-Nov 96. Bug fix Sept 99. Copyright, not Public Domain. */ /* $VER:SlideShowIE Sept3 99 */ /*call open("STDERR","ram:traceSS","W") trace r*/ options results numeric digits 14 /* +++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++ */ address "IMAGEENGINEER" IE_TO_FRONT dir1 = getclip('SlideFiles') if dir1~="" then 'GET_DIR "Select source directory" "OK" 'dir1 else 'GET_DIR "Select source directory" "OK" ' if rc=10 then exit directory = result if upper(directory) = "RAM DISK:" then directory = "Ram:" directory = expandfilename(directory) call setclip('SlideFiles',directory) 'GET_NUMBER "Seconds per Image" 1 30 "OK|Cancel" 3' displaytime = RESULT if displaytime<1 then displaytime=1 /* Display files in one directory and its descendents */ imagecount = 1 newfile = "" oldfile = "" address command 'delete IE:dirlist1' 'delete IE:dirlist' 'list >IE:dirlist1 "'directory'" dirs all LFORMAT="%P%S"' 'sort from IE:dirlist1 to IE:dirlist' call open("dirinput","IE:dirlist","r") /* First display pics in root directory */ 'delete IE:filelist1' 'delete IE:filelist' 'list >IE:filelist1 "'directory'" files LFORMAT="%P%S"' call open('input',"IE:filelist1","r") /* test in case it's empty */ listtest = readln('input') call close('input') if listtest~="" then do 'sort from IE:filelist1 to IE:filelist' address "IMAGEENGINEER" call dirdisplay end /* Now do all the subdirectories */ if~exists("IE:dirlist") then wayout() listtest = readln("dirinput") call seek("dirinput",0,'B') dirtrees = 0 if listtest~="" then do 'REQUEST "Show images in Subdirectories?" "Yes|No"' dirtrees = rc end do d = 1 to 700 dirname = readln("dirinput") if dirname = "" then break address command 'delete IE:filelist1' 'delete IE:filelist' 'list >IE:filelist1 "'dirname'" files LFORMAT="%P%S"' call open('input2',"IE:filelist1","r") /* test in case it's empty */ listtest = readln('input2') call close('input2') if listtest~="" then do 'sort from IE:filelist1 to IE:filelist' address "IMAGEENGINEER" call dirdisplay end end wayout: address "IMAGEENGINEER" IE_TO_FRONT 'REQUEST " Finished "' exit end /* ++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++ */ getpath: parse arg allname pos1 = lastpos("/",allname) if pos1 = 0 then pos1 = lastpos(":",allname) filepath = left(allname,pos1) return filepath getname: parse arg allname pos1 = lastpos("/",allname) if pos1 = 0 then pos1 = lastpos(":",allname) justname = substr(allname,pos1+1) return justname expandfilename: procedure parse arg jfile; if index(jfile,':') = 0 then do curdir = pragma(D); if right(curdir,1) ~= ':' then do if right(curdir,1) ~= '/' then do if curdir ~= '' then do curdir = curdir || '/'; end; end; end; jfile = curdir||jfile; end; return jfile rounded: procedure parse arg number originalNumber = number number = trunc(number) if (originalNumber-number)>0.5 then number=number+1 return number /* ++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++*/ /* Display all the pics in one directory */ dirdisplay: address "IMAGEENGINEER" call open('input3',"IE:filelist","r") do i = 1 to 7000 /* safety limit of 7000 files */ filename = readln('input3') if filename = "" then break slashpos = lastpos("/",filename) dotpos = lastpos(".",filename) if dotpos<slashpos then dotpos = 0 /* not dots in directory names */ if dotpos~=0 then extension = upper(substr(filename,dotpos)) else extension = "" extensionlist = ".INFO .PSFONT .FONT .PDFONT .PFB .AFM .METRIC .LIB .DEM .DOC .TXT .WP .README .ME .ZIP .ARC .ME .DAT .EXE .PIF .INI .TF .DB .C .H .GF .PPRX .PDRX .REXX .ADPRO .CFG .PREFS .HTM .HTML" if pos(upper(extension),extensionlist)~=0 then iterate i if word(filename,2) = "files" then iterate i /* This line not a file name */ if filename="Ram:traceSS" then iterate i if word(filename,1) = "TOTAL:" then break /* or this one */ if upper(extension) = ".LHA" then call UnArc() else success = showpic() end /* end of directory */ call close('input3') return /* +++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++ */ showpic: if ~open("picinput",filename,"R") then return 1 chunks = readch("picinput",1000) call close("picinput") if left(chunks, 4) = ".key" then return 1 /* skip Shell scripts */ address 'IMAGEENGINEER' 'OPEN "'filename'"' /* Quotes allow file names with spaces */ if rc ~=0 then return 1 /* if load fails, try the next one */ newfile = result if oldfile~="" then 'CLOSE "'oldfile'"' oldfile = newfile address command "wait "displaytime address 'IMAGEENGINEER' return 0 /* ++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++ */ /* Unarchive LHA files to HD and display temporary dir */ UnArc: if ~exists("c:lha") then return 1 address command if exists("IE:ssarc") then 'delete IE:ssarc all' /* gets rid of any crash-producing files left from previous run */ 'makedir IE:ssarc' 'lha e -f "'filename'" IE:ssarc/' /* Display files in archive directory and its descendents. LHA files within LHA files are NOT expanded. */ arcimagecount = 1 address command 'delete IE:arcdirlist1' 'delete IE:arcdirlist' 'list >IE:arcdirlist1 IE:ssarc dirs all LFORMAT="%P%S"' 'sort from IE:arcdirlist1 to IE:arcdirlist' call open("arcdirinput","IE:arcdirlist","r") /* First display pics in root directory */ 'delete IE:arcfilelist1' 'delete IE:arcfilelist' 'list >IE:arcfilelist1 IE:ssarc files LFORMAT="%P%S"' call open('arcinput',"IE:arcfilelist1","r") /* test in case it's empty */ listtest = readln('arcinput') call close('arcinput') if listtest~="" then do 'sort from IE:arcfilelist1 to IE:arcfilelist' address "IMAGEENGINEER" call arcdirdisplay end /* Now do all the archive subdirectories */ if~exists("IE:arcdirlist") then return listtest = readln("arcdirinput") call seek("arcdirinput",0,'B') do d = 1 to 700 arcdirname = readln("arcdirinput") if arcdirname = "" then break address command 'delete IE:arcfilelist1' 'delete IE:arcfilelist' 'list >IE:arcfilelist1 "'arcdirname'" files LFORMAT="%P%S"' call open('arcinput2',"IE:arcfilelist1","r") /* test in case it's empty */ listtest = readln('arcinput2') call close('arcinput2') if listtest~="" then do 'sort from IE:arcfilelist1 to IE:arcfilelist' address "IMAGEENGINEER" call arcdirdisplay end end call close("arcdirinput") 'delete IE:ssarc all' return /* +++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++ */ arcdirdisplay: call open('inputarc',"IE:arcfilelist","r") do a = 1 to 7000 /* safety limit of 7000 files */ address command filename = readln('inputarc') if filename = "" then break slashpos = lastpos("/",filename) dotpos = lastpos(".",filename) if dotpos<slashpos then dotpos = 0 /* not dots in directory names */ if dotpos~=0 then extension = upper(substr(filename,dotpos)) else extension = "" /* Note: this time filter out LHA files */ extensionlist = extensionlist||" .LHA" if pos(upper(extension),extensionlist)~=0 then iterate a if word(filename,2) = "files" then iterate /* This line not a file name */ if filename="Ram:traceSS" then iterate if word(filename,1) = "TOTAL:" then break /* or this one */ success = showpic() end /* end of directory */ call close('inputarc') return 0